package com.aspose.cells;

import java.util.ArrayList;

class zauh {
   protected com.aspose.cells.b.a.b.zq a;
   protected float b;
   protected float c;
   protected float d;
   private float s;
   private float t;
   private Color u;
   private int v;
   private int w;
   protected com.aspose.cells.b.a.b.zc e;
   protected com.aspose.cells.b.a.b.zc f;
   protected com.aspose.cells.b.a.b.zc g;
   protected com.aspose.cells.b.a.b.zc h;
   protected com.aspose.cells.b.a.b.zc i;
   protected com.aspose.cells.b.a.b.zm j;
   protected com.aspose.cells.b.a.b.zo k;
   protected com.aspose.cells.b.a.b.zo l;
   protected com.aspose.cells.b.a.b.zo m;
   protected com.aspose.cells.b.a.b.zo n;
   protected com.aspose.cells.b.a.b.zo o;
   protected com.aspose.cells.b.a.b.zo p;
   protected zavv q;
   protected zavv r;
   private String x;
   private boolean y;
   private static float z = 20.0F;
   private zjd A;

   protected zauh() {
      this.u = Color.getEmpty();
      this.v = 0;
      this.w = 0;
      this.e = null;
      this.f = null;
      this.g = null;
      this.h = null;
      this.i = null;
      this.j = null;
      this.q = zavv.a;
      this.r = zavv.a;
      this.y = false;
      this.A = null;
   }

   public zauh(float var1, float var2, float var3, float var4, float var5, float var6, float var7, Color var8, int var9, int var10) {
      this();
      this.s = var6;
      this.t = var7;
      this.u = var8;
      this.v = var9;
      this.w = var10;
      Color var11 = zrz.a(var10, var8);
      this.j = new com.aspose.cells.b.a.b.zm(var11);
      this.j.e(2);
      this.c(var1, var2, var3, var4, var5);
   }

   public zauh(float var1, float var2, float var3, float var4, float var5, float var6, float var7, Color var8, int var9, int var10, float var11, zjd var12) {
      this(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11);
      this.A = var12;
      if (var12 != null) {
         this.j = zama.a(var12.k());
      }

   }

   public zauh(com.aspose.cells.b.a.b.zq var1, float var2, float var3, float var4, Color var5, int var6, int var7) {
      this(var1.f(), var1.g(), var1.h(), var1.i(), var2, var3, var4, var5, var6, var7);
   }

   public zauh(float var1, float var2, float var3, float var4, float var5, float var6, float var7, Color var8, int var9, int var10, float var11) {
      this(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10);
      this.j.b(var11);
   }

   protected void finalize() throws Exception {
      this.a(false);
   }

   public void a() {
      this.a(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void a(boolean var1) {
      if (!this.y) {
         if (var1) {
            this.j.a();
            this.k();
            this.q.a();
            this.r.a();
         }

         this.y = true;
      }

   }

   public Object b() {
      zauh var1 = new zauh(this.g(), this.h(), this.c(), this.d(), this.u, this.v, this.w);
      var1.a(this.j());
      return var1;
   }

   public float c() {
      return this.c;
   }

   public float d() {
      return this.d;
   }

   public float e() {
      return (this.c + this.d) % 360.0F;
   }

   public String f() {
      return this.x;
   }

   public void a(String var1) {
      this.x = var1;
   }

   public com.aspose.cells.b.a.b.zo a(float var1, float[] var2) {
      com.aspose.cells.b.a.b.zo var3 = com.aspose.cells.b.a.b.zo.a();
      if (this.d() >= 180.0F) {
         var2[0] = this.c(this.c()) + this.d() / 2.0F;
         var3 = this.b(this.k.d(), this.k.e(), this.a.h() * var1, this.a.i() * var1, var2[0]);
      } else {
         float var4 = (this.m.d() + this.o.d()) / 2.0F;
         float var5 = (this.m.e() + this.o.e()) / 2.0F;
         float var6 = (float)(Math.atan2((double)(var5 - this.k.e()), (double)(var4 - this.k.d())) * 180.0D / 3.141592653589793D);
         var2[0] = this.c(var6);
         var3 = this.b(this.k.d(), this.k.e(), this.a.h() * var1, this.a.i() * var1, var2[0]);
      }

      var2[0] %= 360.0F;
      if (var2[0] < 0.0F) {
         var2[0] += 360.0F;
      }

      return var3;
   }

   public com.aspose.cells.b.a.b.zo a(float var1, int var2, float[] var3) {
      com.aspose.cells.b.a.b.zo var4 = com.aspose.cells.b.a.b.zo.a();
      if (this.d() >= 180.0F) {
         var3[0] = this.c(this.c()) + this.d() / 2.0F;
         var3[0] += (float)var2;
         var4 = this.b(this.k.d(), this.k.e(), this.a.h() * var1, this.a.i() * var1, var3[0]);
      } else {
         float var5 = (this.m.d() + this.o.d()) / 2.0F;
         float var6 = (this.m.e() + this.o.e()) / 2.0F;
         float var7 = (float)(Math.atan2((double)(var6 - this.k.e()), (double)(var5 - this.k.d())) * 180.0D / 3.141592653589793D);
         var3[0] = this.c(var7);
         var3[0] += (float)var2;
         var4 = this.b(this.k.d(), this.k.e(), this.a.h() * var1, this.a.i() * var1, var3[0]);
      }

      var3[0] %= 360.0F;
      if (var3[0] < 0.0F) {
         var3[0] += 360.0F;
      }

      return var4;
   }

   com.aspose.cells.b.a.b.zq g() {
      return this.a;
   }

   float h() {
      return this.b;
   }

   void a(zn var1) {
      this.e(var1);
      if (this.c() > 90.0F && this.c() < 270.0F) {
         this.c(var1);
         this.b(var1);
      } else {
         this.b(var1);
         this.c(var1);
      }

      this.d(var1);
   }

   zauh[] a(float var1) {
      if (this.c() != var1 && this.e() != var1) {
         this.b(var1);
         float var3 = this.c(this.c());
         float var4 = (var1 - var3 + 360.0F) % 360.0F;
         zauh var5 = new zauh(this.g(), this.h(), var3, var4, this.u, this.v, this.w);
         var5.a(this.A);
         var5.a(true, false);
         var4 = this.c(this.e()) - var1;
         zauh var6 = new zauh(this.g(), this.h(), var1, var4, this.u, this.v, this.w);
         var6.a(this.A);
         var6.a(false, true);
         return new zauh[]{var5, var6};
      } else {
         return new zauh[]{(zauh)this.b()};
      }
   }

   void a(float var1, float var2, float var3, float var4, float var5) {
      this.c(var1, var2, var3, var4, var5);
   }

   void b(zn var1) {
      if (this.q != null) {
         if (this.c() > 90.0F && this.c() < 270.0F) {
            this.q.a(var1, this.j, this.g, this.A);
         } else {
            this.q.a(var1, this.j, this.e, this.A);
         }
      }

   }

   void c(zn var1) {
      if (this.r != null) {
         if (this.e() > 90.0F && this.e() < 270.0F) {
            this.r.a(var1, this.j, this.e, this.A);
         } else {
            this.r.a(var1, this.j, this.h, this.A);
         }
      }

   }

   void d(zn var1) {
      zauh.za[] var2 = this.m();
      zauh.za[] var3 = var2;
      int var4 = var2.length;

      for(int var5 = 0; var5 < var4; ++var5) {
         zauh.za var6 = var3[var5];
         this.a(var1, this.j, this.i, var6.a(), var6.b(), var6.c(), var6.d());
      }

   }

   void e(zn var1) {
      zauh.za[] var2 = this.n();
      zauh.za[] var3 = var2;
      int var4 = var2.length;

      for(int var5 = 0; var5 < var4; ++var5) {
         zauh.za var6 = var3[var5];
         this.a(var1, this.j, this.e, var6.a(), var6.b(), var6.c(), var6.d());
      }

   }

   void f(zn var1) {
      com.aspose.cells.b.a.b.zc var2 = this.e;
      com.aspose.cells.b.a.b.zm var3 = this.j;
      com.aspose.cells.b.a.b.a.ze var4 = new com.aspose.cells.b.a.b.a.ze();
      var4.b(this.a.f(), this.a.g() + this.b, this.a.h(), this.a.i(), this.c, this.d);
      if (this.A != null && this.A.i().f()) {
         var2 = zax.a(this.A.i(), com.aspose.cells.a.c.zn.a(var4));
      }

      var1.a(var2, var4);
      var1.a(var3, var4);
   }

   void g(zn var1) {
      com.aspose.cells.b.a.b.zc var2 = this.e;
      com.aspose.cells.b.a.b.zm var3 = this.j;
      com.aspose.cells.b.a.b.a.ze var4 = new com.aspose.cells.b.a.b.a.ze();
      var4.b(this.a.f(), this.a.g(), this.a.h(), this.a.i(), this.c, this.d);
      if (this.A != null && this.A.i().f()) {
         var2 = zax.a(this.A.i(), com.aspose.cells.a.c.zn.a(var4));
      }

      var1.a(var2, var4);
      if (var3.c().getA() != 0) {
         var1.a(var3, var4);
      } else {
         com.aspose.cells.b.a.b.zm var5 = new com.aspose.cells.b.a.b.zm(var2, 1.0F);

         try {
            var1.a(var5, var4);
         } finally {
            if (var5 != null) {
               var5.r();
            }

         }
      }

   }

   com.aspose.cells.b.a.b.zq i() {
      com.aspose.cells.b.a.b.zq var1 = new com.aspose.cells.b.a.b.zq(this.m.d(), this.m.e(), 0.0F, 0.0F);
      com.aspose.cells.b.a.b.zq[] var2;
      if (this.c == 0.0F || this.c + this.d >= 360.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadf.a(var2, this.a.l());
         var1 = var2[0];
      }

      if (this.c <= 90.0F && this.c + this.d >= 90.0F || this.c + this.d >= 450.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadf.b(var2, this.a.m() + this.h());
         var1 = var2[0];
      }

      if (this.c <= 180.0F && this.c + this.d >= 180.0F || this.c + this.d >= 540.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadf.a(var2, this.a.j());
         var1 = var2[0];
      }

      if (this.c <= 270.0F && this.c + this.d >= 270.0F || this.c + this.d >= 630.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadf.b(var2, this.a.k());
         var1 = var2[0];
      }

      var2 = new com.aspose.cells.b.a.b.zq[]{var1};
      zadf.a(var2, this.k);
      var1 = var2[0];
      var2[0] = var1;
      zadf.a(var2, this.l);
      var1 = var2[0];
      var2[0] = var1;
      zadf.a(var2, this.m);
      var1 = var2[0];
      var2[0] = var1;
      zadf.a(var2, this.n);
      var1 = var2[0];
      var2[0] = var1;
      zadf.a(var2, this.o);
      var1 = var2[0];
      var2[0] = var1;
      zadf.a(var2, this.p);
      var1 = var2[0];
      return var1;
   }

   zjd j() {
      return this.A;
   }

   void a(zjd var1) {
      this.A = var1;
   }

   protected void a(Color var1, int var2) {
      this.e = new com.aspose.cells.b.a.b.zu(var1);
      this.f = new com.aspose.cells.b.a.b.zu(zkl.a(var1, zkl.a));
      switch(var2) {
      case 0:
         Color var3 = Color.fromArgb((var1.getR() & 255) / 2, (var1.getG() & 255) / 2, (var1.getB() & 255) / 2);
         this.g = this.h = this.i = new com.aspose.cells.b.a.b.zu(var3);
         break;
      case 1:
         this.g = this.h = this.i = new com.aspose.cells.b.a.b.zu(zkl.a(var1, -zkl.a));
         break;
      case 2:
         double var4 = (double)(this.c - 180.0F - z);
         if (var4 < 0.0D) {
            var4 += 360.0D;
         }

         this.g = this.a(var1, var4);
         var4 = (double)(this.c + this.d - z);
         if (var4 < 0.0D) {
            var4 += 360.0D;
         }

         this.h = this.a(var1, var4);
         this.i = this.a(var1);
      }

   }

   protected void k() {
      this.e.h();
      this.g.h();
      this.h.h();
      this.i.h();
      this.f.h();
   }

   protected com.aspose.cells.b.a.b.zc a(Color var1, double var2) {
      return new com.aspose.cells.b.a.b.zu(zkl.a(var1, -((float)((double)zkl.a * (1.0D - 0.8D * Math.cos(var2 * 3.141592653589793D / 180.0D))))));
   }

   protected com.aspose.cells.b.a.b.zc a(Color var1) {
      com.aspose.cells.b.a.b.a.zc var2 = new com.aspose.cells.b.a.b.a.zc();
      var2.a(new Color[]{zkl.a(var1, -zkl.a / 2.0F), var1, zkl.a(var1, -zkl.a)});
      var2.a(new float[]{0.0F, 0.1F, 1.0F});
      com.aspose.cells.b.a.b.a.zh var3 = new com.aspose.cells.b.a.b.a.zh(this.a, Color.getBlue(), Color.getWhite(), 0);
      var3.a(var2);
      return var3;
   }

   protected void a(zn var1, com.aspose.cells.b.a.b.zm var2, com.aspose.cells.b.a.b.zc var3, float var4, float var5, com.aspose.cells.b.a.b.zo var6, com.aspose.cells.b.a.b.zo var7) {
      com.aspose.cells.b.a.b.a.ze var8 = this.a(var4, var5, var6, var7);
      if (this.A != null && this.A.i().f()) {
         var3 = zax.a(this.A.i(), com.aspose.cells.a.c.zn.a(var8), 0.5F);
      }

      if (this.A.i().h() != 0) {
         var1.a(var3, var8);
      }

      if (this.A.k().e()) {
         var1.a(var2, var8);
      }

   }

   protected float b(float var1) {
      double var2 = (double)this.a.h() * Math.cos((double)var1 * 3.141592653589793D / 180.0D);
      double var4 = (double)this.a.i() * Math.sin((double)var1 * 3.141592653589793D / 180.0D);
      float var6 = (float)(Math.atan2(var4, var2) * 180.0D / 3.141592653589793D);
      return var6 < 0.0F ? var6 + 360.0F : var6;
   }

   protected float c(float var1) {
      double var2 = (double)this.a.i() * Math.cos((double)var1 * 3.141592653589793D / 180.0D);
      double var4 = (double)this.a.h() * Math.sin((double)var1 * 3.141592653589793D / 180.0D);
      float var6 = (float)(Math.atan2(var4, var2) * 180.0D / 3.141592653589793D);
      return var6 < 0.0F ? var6 + 360.0F : var6;
   }

   protected com.aspose.cells.b.a.b.zo b(float var1, float var2, float var3, float var4, float var5) {
      double var6 = (double)var5 * 3.141592653589793D / 180.0D;
      return new com.aspose.cells.b.a.b.zo(var1 + (float)((double)var3 * Math.cos(var6)), var2 + (float)((double)var4 * Math.sin(var6)));
   }

   private void c(float var1, float var2, float var3, float var4, float var5) {
      this.a = new com.aspose.cells.b.a.b.zq(var1, var2, var3, var4);
      this.b = var5;
      this.c = this.b(this.s);
      this.d = this.t;
      if (this.d % 180.0F != 0.0F) {
         this.d = this.b(this.s + this.t) - this.c;
      }

      if (this.d < 0.0F) {
         this.d += 360.0F;
      }

      this.a(this.u, this.v);
      float var6 = var1 + var3 / 2.0F;
      float var7 = var2 + var4 / 2.0F;
      this.k = new com.aspose.cells.b.a.b.zo(var6, var7);
      this.l = new com.aspose.cells.b.a.b.zo(var6, var7 + var5);
      this.m = this.b(var6, var7, var3 / 2.0F, var4 / 2.0F, this.s);
      this.n = new com.aspose.cells.b.a.b.zo(this.m.d(), this.m.e() + var5);
      this.o = this.b(var6, var7, var3 / 2.0F, var4 / 2.0F, this.s + this.t);
      this.p = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e() + var5);
      this.l();
   }

   private void l() {
      this.a(true, true);
   }

   private void a(boolean var1, boolean var2) {
      if (var1) {
         this.q = new zavv(this.k, this.m, this.n, this.l, this.d != 180.0F);
      } else {
         this.q = zavv.a;
      }

      if (var2) {
         this.r = new zavv(this.k, this.o, this.p, this.l, this.d != 180.0F);
      } else {
         this.r = zavv.a;
      }

   }

   private zauh.za[] m() {
      ArrayList var1 = new ArrayList();
      if (this.d != 0.0F && (this.c < 180.0F || this.c + this.d > 360.0F)) {
         float var2;
         com.aspose.cells.b.a.b.zo var3;
         float var4;
         com.aspose.cells.b.a.b.zo var5;
         if (this.c() < 180.0F) {
            var2 = this.c;
            var3 = new com.aspose.cells.b.a.b.zo(this.m.d(), this.m.e());
            var4 = this.e();
            var5 = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e());
            if (this.c + this.d > 180.0F) {
               var4 = 180.0F;
               var5.a(this.a.f());
               var5.b(this.k.e());
            }

            com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zauh.za(var2, var4, var3, var5)));
         }

         if (this.c + this.d > 360.0F) {
            var2 = 0.0F;
            var3 = new com.aspose.cells.b.a.b.zo(this.a.l(), this.k.e());
            var4 = this.e();
            var5 = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e());
            if (var4 > 180.0F) {
               var4 = 180.0F;
               var5.a(this.a.j());
               var5.b(this.k.e());
            }

            com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zauh.za(var2, var4, var3, var5)));
         }
      }

      return (zauh.za[])((zauh.za[])com.aspose.cells.b.a.a.ze.a(var1, zauh.za.class));
   }

   private zauh.za[] n() {
      ArrayList var1 = new ArrayList();
      if (this.d != 0.0F && (this.c < 0.0F || this.c + this.d > 180.0F) && this.c + this.d > 180.0F) {
         float var2 = this.c;
         com.aspose.cells.b.a.b.zo var3 = new com.aspose.cells.b.a.b.zo(this.m.d(), this.m.e());
         float var4 = this.c + this.d;
         com.aspose.cells.b.a.b.zo var5 = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e());
         if (var2 < 180.0F) {
            var2 = 180.0F;
            var3.a(this.a.j());
            var3.b(this.k.e());
         }

         if (var4 > 360.0F) {
            var4 = 360.0F;
            var5.a(this.a.l());
            var5.b(this.k.e());
         }

         com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zauh.za(var2, var4, var3, var5)));
         if (this.c < 360.0F && this.c + this.d > 540.0F) {
            var2 = 180.0F;
            var3 = new com.aspose.cells.b.a.b.zo(this.a.j(), this.k.e());
            var4 = this.e();
            var5 = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e());
            com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zauh.za(var2, var4, var3, var5)));
         }
      }

      return (zauh.za[])((zauh.za[])com.aspose.cells.b.a.a.ze.a(var1, zauh.za.class));
   }

   private com.aspose.cells.b.a.b.a.ze a(float var1, float var2, com.aspose.cells.b.a.b.zo var3, com.aspose.cells.b.a.b.zo var4) {
      com.aspose.cells.b.a.b.a.ze var5 = new com.aspose.cells.b.a.b.a.ze();
      var5.a(this.a, var1, var2 - var1);
      var5.b(var4.d(), var4.e(), var4.d(), var4.e() + this.b);
      var5.a(this.a.f(), this.a.g() + this.b, this.a.h(), this.a.i(), var2, var1 - var2);
      var5.b(var3.d(), var3.e() + this.b, var3.d(), var3.e());
      var5.i();
      return var5;
   }

   private final class za {
      private float b;
      private float c;
      private com.aspose.cells.b.a.b.zo d;
      private com.aspose.cells.b.a.b.zo e;

      public za(float var2, float var3, com.aspose.cells.b.a.b.zo var4, com.aspose.cells.b.a.b.zo var5) {
         this.b = var2;
         this.c = var3;
         this.d = var4;
         this.e = var5;
      }

      public float a() {
         return this.b;
      }

      public float b() {
         return this.c;
      }

      public com.aspose.cells.b.a.b.zo c() {
         return this.d;
      }

      public com.aspose.cells.b.a.b.zo d() {
         return this.e;
      }
   }
}
